# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
# Contributor: Alasdair Haswell <ali at arhaswell dot co dot uk>

pkgname=rng-tools
pkgver=6.16
pkgrel=1
pkgdesc="Random number generator related utilities"
arch=('loong64' 'x86_64')
url="https://github.com/nhorman/rng-tools"
license=('GPL')
depends=('curl' 'libxml2' 'sysfsutils' 'jitterentropy' 'libp11' 'jansson' 'rtl-sdr')
optdepends=('opensc: PKCS11 entropy engine to gather entropy from smart card readers')
backup=(etc/conf.d/rngd)
options=('debug')
source=(https://github.com/nhorman/rng-tools/archive/v$pkgver/$pkgname-$pkgver.tar.gz
        rngd.conf
        rngd.service)
sha256sums=('17666c4745fb635d91df293be188daf94b9e465d51d8503c0195fa3beb390894'
            'f4fd197dd682cdab07ddeabe8d3b73b1bc2e1cf322237be238a26b49a7dcb047'
            '733733457a2470da0d09a5a4e6d98fb0a773d3acf0722d16258caa2997a3fd4b')

prepare() {
	cd $pkgname-$pkgver
	mv README{.md,}

	libtoolize --force
	aclocal
	autoheader
	automake --force-missing --add-missing
	autoconf
}

build() {
	cd $pkgname-$pkgver
	./configure --prefix=/usr --sbindir=/usr/bin
	make
}

package() {
	cd $pkgname-$pkgver
	make DESTDIR="$pkgdir" install
	install -Dm644 ../rngd.service "$pkgdir"/usr/lib/systemd/system/rngd.service
	install -Dm644 ../rngd.conf "$pkgdir"/etc/conf.d/rngd
}
